#ifndef _INDIVIDUAL_H_
#define _INDIVIDUAL_H_

#include "config.h"

#include <bitset>


class Individual
{
  public:
    Individual();
    void randomizeGenes();
    // Crossover
    void mate(const Individual *p_partner, 
        Individual *&p_child_a,
        Individual *&p_child_b);
    // Mutation
    void mutate();
    // Setters and Getters
    unsigned int getFitness() const;
    void setFitness(unsigned int p_fitness);
    bool getGene(unsigned int p_loci) const;
    void setGene(unsigned int p_loci, bool p_value);
    unsigned int getHistorySize() const;
    std::string getGenesAsString() const;
    bool isMutant();
    // Individual operators
    Individual *clone(); // Clone myself.
    Individual &operator=(const Individual &p_i);


  private:
    std::bitset<I_MAX_LOCI> m_genes;
    // Bits in our chromosome that represent history length.
    unsigned int m_history_bits;
    // Number of entries required for the desired history size.
    int m_loci_count;
    // My fitness
    unsigned int m_fitness;
    // Am I the product of a mutation?
    bool m_mutant;
};


#endif /* _INDIVIDUAL_H_ */
